{include file="common/head"/}
<body>
<style>
    .layui-form-mid{padding: 0!important;}
</style>
<div class="header">
    <div class="main">
        <a class="logo" href="{:url('index/index')}" title="CLTPHP">CLTPHP</a>
        <div class="nav-user">
        </div>
    </div>
</div>
<div class="main layui-clear">
    <div class="fly-panel fly-panel-user" pad20>
        <div class="layui-tab layui-tab-brief">
            <ul class="layui-tab-title">
                <li class="layui-this">登入</li>
                <li><a href="{:url('reg')}">注册</a></li>
            </ul>
            <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
                <div class="layui-tab-item layui-show">
                    <div class="layui-form layui-form-pane">
                        <form method="post">
                            <div class="layui-form-item">
                                <label for="username" class="layui-form-label">帐　号</label>
                                <div class="layui-input-inline">
                                    <input type="text" id="username" name="username" required lay-verify="required" placeholder="请输入邮箱或者手机号" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label for="L_pass" class="layui-form-label">密　码</label>
                                <div class="layui-input-inline">
                                    <input type="password" id="L_pass" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            {if $sys.code=='open'}
                            <div class="layui-form-item">
                                <label for="L_vercode" class="layui-form-label">验证码</label>
                                <div class="layui-input-inline">
                                    <input type="text" id="L_vercode" name="vercode" required lay-verify="required" placeholder="请输入验证码" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid captcha">
                                    <img src="{:url('verify')}" alt="captcha" onclick="this.src='{:url("verify")}?'+'id='+Math.random()"/>
                                </div>
                            </div>
                            {/if}
                            <div class="layui-form-item">
                                <button type="button" class="layui-btn" lay-filter="sub" lay-submit>立即登录</button>
                                <span style="padding-left:20px;"><a href="{:url('forget')}">忘记密码？</a></span>
                            </div>
                            <div class="layui-form-item fly-form-app">
                                <span>或者使用社交账号登入</span>
                                {volist name="plugin" id="v"}
                                <a href="{:url('oauth/login',['type'=>$v.code])}" id="qqLogin" class="iconfont icon-qq" title="{$v.name}"></a>
                                {/volist}
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="common/footer"/}
<script>
    layui.use(['form', 'layer'], function () {
        var form = layui.form,$ = layui.jquery;
        // 登录提交监听
        form.on('submit(sub)', function (data) {
            var loading = layer.load(1, {shade: [0.1, '#fff']});
            $.post("{:url('index')}",data.field,function(res){
                layer.close(loading);
                if(res.code > 0){
                    layer.msg(res.msg,{time:1000,icon:1},function(){
                        location.href = "{:url('index/index')}";
                    });
                }else{
                    layer.msg(res.msg,{time:1000,icon:2});
                    $('.captcha img').attr('src','{:url("verify")}?id='+Math.random());
                }
            });
        })
    })
</script>
</body>
</html>
